<template>
	<view class="sign_detail">
		<view class="col-3">
			当前<span class='f-40'>{{list.user_point}}</span>积分
		</view>
		<view class="col-3 m-t">
			<view class="sign_b flex">
				<view class="">
					已坚持
				</view>
				<view class="flex">
					<view class="num">
						{{cont_days1}}
					</view>
					<view class="num">
						{{cont_days2}}
					</view>
					<view class="num">
						{{cont_days3}}
					</view>
				</view>
				<view class="">
					天签到
				</view>
			</view>

		</view>
		<view class="sign_btn">
			连续签到7天 可获得更多积分
		</view>


		<view class="date">
			<view class="">
					<view class="flex_1">
						<view class="flex-item flex_1" v-for="item in weeks" >
							<text class="week">{{item}}</text>
						</view>
					</view>
					<view class="flex-wrap">
						<template v-for="(item,index) in visibleDays"  :Key="item.day">
							<view v-for="(i,j) in item">
								<view class="day-box flex-column" :class="[days==i.day?'day-box-a':'']" @click="clickDate(i.day)">
									<view class="">
										{{i.day}}
									</view>
									<view :class="[i.point=='未签到'?'textColor':'textColor_a']">
										{{i.day==''?'':i.point}}
									</view>
								</view>
							</view>
						</template>
					</view>
			</view>
			<u-line color="#E6E7E8" />
			<view class="">
			</view>
			<view class="gzx flex flex-y-c flex-x-b" @click="gz">
				<view class="gz flex">
					<img src="../../static/sign/gold.png" alt="">
					<view class="">
						积分规则
					</view>
				</view>
				<view class="">
					<image style="width: 30rpx;height: 36rpx;" src="../../static/right.png" mode=""></image>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import * as Api from '@/api/pony'
	export default {
		data() {
			return {
				list:{},
				weeks:[],
				visibleDays:[],
				days:'1',
				cont_days1:'',
				cont_days2:'',
				cont_days3:''
			}
		},
		onLoad() {
			this.getMlist();
		},
		methods: {
			clickDate(m){
				this.days=m
				console.log(this.days)
			},
			getMlist(){
				const app = this
				Api.getMonth()
				.then(result => {
					// 设置页面数据
					app.list = result.data
					app.weeks=app.list.list[0]
					app.visibleDays=app.list.list.slice(1)
					app.cont_days1=app.list.cont_days.slice(0,1)
					app.cont_days2=app.list.cont_days.slice(1,2)
					app.cont_days3=app.list.cont_days.slice(2,3)
				})
			},
			calendarTap(e) {
				console.log(e);
			},
			gz() {
				uni.navigateTo({
					url: '/pages/rule/index'
				})
			},
		}
	}
</script>

<style scoped>
	.textColor{
		font-size: 20rpx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: #9C9C9C;
	}
	.textColor_a{
		font-size: 20rpx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: #F8BA33;
	}
	.content {
		width: 100%;
		margin: 0 auto;
	}
	.flex_1 {
		width: 100%;
		display: flex;
		align-items: center;
		justify-content: space-between;
		flex-direction: row;
	}
	.flex-wrap {
		width: 103%;
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		/* justify-content: space-between; */
		flex-direction: row;
	}
	.flex-column {
		width: 100%;
		height: 90rpx;
		display: flex;
		flex-direction: column;
		justify-content: flex-start;
		align-items: center;
	}
	.flex-item {
		flex: 1;
	}
	.bold {
		font-weight: bold;
		font-size: 28rpx;
	}
	.year-month {
		width: 400rpx;
		margin: 0 auto 20rpx;
		padding-top: 20rpx;
	}
	.week {
		margin: 20rpx 20rpx 40rpx;
		width: 60rpx;
		text-align: center;
		color: #999999;
	}
	
	.day-box {
		width: 100rpx;
		text-align: center;
		display: flex;
		flex-direction: column;
	}
	.day-box-a{
		width: 90rpx;
		/* height: 103rpx; */
		background: #F8BA33;
		border-radius: 50%;
		text-align: center;
		display: flex;
		flex-direction: column;
	}
	.day {
		width: 60rpx;
		height: 60rpx;
		line-height: 60rpx;
		border-radius: 50%;
		text-align: center;
		font-weight: 600;
	}
	.day-text {
		font-size: 22rpx;
	}
	
	
	.sign{
		background: #f5f5f5;
	}
	.flex {
		display: flex;
	}

	.flex-y-c {
		align-items: center;
	}

	.flex-x-b {
		justify-content: space-between;
	}

	.flex-x-a {
		justify-content: space-around;
	}

	.col-3 {
		color: #333;
		font-weight: bold;
	}

	.f-40 {
		font-size: 40rpx;
	}

	.m-t {
		margin-top: 50rpx;
	}

	.gzx {
		padding: 30rpx 20rpx;
	}

	.gz img {
		width: 39rpx;
		height: 39rpx;
		margin-right: 10rpx;
	}

	.sign_detail {
		height: 100vh;
		background: linear-gradient(184deg, #F8BA33 0%, rgba(245, 245, 245, 0) 100%);
		padding: 30rpx;
	}

	.sign_b {
		width: 476rpx;
		margin: 0 auto;
		line-height: 100rpx;
	}

	.sign_btn {
		width: 476rpx;
		height: 80rpx;
		background: linear-gradient(90deg, #FF8900, #FF8900);
		border-radius: 40rpx;
		line-height: 80rpx;
		text-align: center;
		color: #fff;
		margin: 0 auto;
		margin-top: 30rpx;
	}

	.num {
		width: 76rpx;
		height: 100rpx;
		background: linear-gradient(0deg, #FFFFFF, #E6E2E1);
		border-radius: 12rpx;
		margin: 0 10rpx;
		text-align: center;
		font-size: 67rpx;
		font-weight: 500;
		color: #FFAB00;
	}

	.date {
		width: 686rpx;
		/* height: 839rpx; */
		background: #FFFFFF;
		border-radius: 21rpx;
		margin-top: 30rpx;
	}
</style>
